//事件模块

// 1. 引入事件模块
const event = require('events')
const event = require('events')

// 2.创建EventEmitter对象
var myEmitter = new event.EventEmitter()
var myEmitter = new event.EventEmitter()

// 3。注册事件
myEmitter.on('someEvent',function(a){
    console.log('`````````')
})
myEmitter.on('someEvent',function(msg){
    setImmediate(()=>{
        console.log('这个函数导致异步')
    })
})


   
// 4.触发事件
myEmitter.emit('someEvent')
myEmiiter.emit('someEvent','我是参数')


